package com.niit.search.mapper;

import com.niit.search.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM tb_user WHERE nickname LIKE CONCAT('%', #{keyword}, '%')")
    List<User> searchUserByKeyword(@Param("keyword") String keyword);

    @Select("SELECT * FROM tb_user WHERE username LIKE CONCAT('%', #{keyword}, '%')")
    List<User> searchUserByUsername(@Param("keyword") String keyword);

    @Select("SELECT * FROM tb_user WHERE id = #{id}")
    User selectById(Long id);
} 